#ifndef THREAD_SERVICE_INCLUDED
#define THREAD_SERVICE_INCLUDED


class ThreadService
{
	static void *bootThreadProcess (void *dummyPt)
	{
		std::cout << "bootThreadProcess" << std::endl;
		ThreadService * test = (class ThreadService*)dummyPt;
		test->processThreadProcess();
		std::cout << "processThreadProcess STOPPED" << std::endl;
		return 0;
	}
public:
	virtual void processThreadProcess()=0;
	ThreadService(bool start = true)
	{
		if(start)
			startProcess();
	}
	void startProcess()
	{
		m_thread = new pthread_t;
		pthread_create(m_thread, NULL, bootThreadProcess, this);

	}
	void join()
	{
		pthread_join(*m_thread, NULL);
	}
private:
	pthread_t* m_thread;
};

#endif
